package trong.gold.soft.com.view;

import trong.gold.soft.com.main.*;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;

import trong.gold.soft.com.model.Resources;
import trong.gold.soft.com.model.createImg;
import trong.gold.soft.com.model.font.VietnameseFont;

public class thanhtichTetris extends GameCanvas{
	
	private Image backgr,ktin;
	private Graphics g;
	private String back = "Quay lại";
	private String ttName = "thong-tin.png";
	private mTetrisMidlet midlet;
	protected thanhtichTetris(mTetrisMidlet midlet) {
		super(false);
		this.midlet = midlet;
		this.g = this.getGraphics();
		setFullScreenMode(true);
		backgr = createImg.createImage("/com/image/" + Resources.backgrName);
		ktin = createImg.createImage("/com/image/" + ttName);
		Draw();
	}
	private void Draw(){
		g.drawImage(backgr, 0, 0, Resources.TOP_LEFT_ANCHOR);
		g.drawImage(ktin, 0, this.getHeight() - 25, Graphics.BOTTOM | Graphics.LEFT);
		VietnameseFont.BlackBold.DrawString(g, back,this.getWidth()/2, this.getHeight() - VietnameseFont.WhiteBold.getHeight(), Graphics.HCENTER);
		flushGraphics();
	}
	public void keyPressed(int keyCode) {
		
		switch (keyCode) {
			case -5:
				setnull();
				Runtime.getRuntime().gc();
				midlet.switchState(this,new menuTetris(midlet));
				break;
		}
	}
	private void setnull(){
		g=null;
		backgr=null;
		ktin=null;
	}
}
